using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Helper;
namespace CoreData
{
    /// <summary>
    /// Core data class
    /// Code by: Linh Pham
    /// </summary>
    public class Merchant_Payment
    {
            public long ID{get;set;}
            public long MerchantID{get;set;}
            public int Money{get;set;}
            public DateTime DateOfPayment{get;set;}
            public string Description{get;set;}
         
        public Merchant_Payment()
        {       
                    Description ="";   
        }
        
       static Merchant_Payment DynamicCast<T>(object row_data, object row_header) where T : Merchant_Payment
       {
           // row_data : DataRow
           // row_header : DataColumnCollection
           Merchant_Payment ret = new Merchant_Payment();
           DataRow dt = (DataRow)row_data;

           foreach (DataColumn column in (DataColumnCollection)row_header)
           {
               switch (column.ColumnName)
               {
                      case  "ID":
                        ret.ID = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "MerchantID":
                        ret.MerchantID = ConvertObject.ToLong(dt[column]);
                       break;
                      case  "Money":
                        ret.Money = ConvertObject.ToInt(dt[column]);
                       break;
                      case  "DateOfPayment":
                        ret.DateOfPayment = ConvertObject.ToDateTime(dt[column]);
                       break;
                      case  "Description":
                        ret.Description = ConvertObject.ToString(dt[column]);
                       break;
                
                   default:
                       break;
               }
           }

           return ret;
       }
        
    }
}
